import Vue from 'vue'
import Router from 'vue-router'

//逻辑组件(不可复用)
import User from '@/pages/User' //用户中心界面
import GoodsList from '@/pages/GoodsList' //商品列表界面
import Shop from '@/pages/Shop' //商城界面

//视图组件(可复用)
import UserEdit from '@/components/UserEdit'   //用户信息修改组件
import UserInfo from '@/components/UserInfo'   //用户信息组件
import GoodsDetail from '@/components/GoodsDetail'     //商品详情组件
import GoodsActivity from '@/components/GoodsActivity' //获取商品组件
import About from '@/components/About' //关于我们组件
import Home from '@/components/Home'   //主页组件
import NotFoundComponent from '@/components/NotFoundComponent'   //主页组件


//如果使用路由插件必须执行use函数安装路由插件
Vue.use(Router)

export default new Router({
  routes: [
    { path: '*', component: NotFoundComponent },
    {
      path: '/',
      name: 'Home',
      component: Home
    },
    {
      path: '/user',
      name: 'User',
      component: User,
      children : [
        {
          path: '/',
          name: 'UserInfo',
          component: UserInfo
        },
        {
          path: '/userEdit',
          name: 'UserEdit',
          component: UserEdit
        }
      ]
    },
    {
      path: '/shop',
      name: 'Shop',
      component : Shop,
    },
    {
      path: '/goodsDetail',
      //动态路径参数
      //path: '/goodsDetail/:id',
      name: 'goodsDetail',
      component: GoodsDetail
    },
    {
      path: '/about',
      name: 'About',
      component: About
    },
  ]
})
